package YahooFinance.helper.updatethread;

import YahooFinance.YahooQuoteFetcher;
import android.app.Activity;
import android.widget.TextView;

public class AndroidUpdateThread extends UpdateThread {

	private  Activity mActivity;
	private TextView mTextView;
	private  String mReturnStatement;
	
	public AndroidUpdateThread(int pSeconds, YahooQuoteFetcher pFetcher,
			Activity pActivity, TextView pTextView) {
		super(pSeconds, pFetcher, null);
		
		mActivity = pActivity;
		mTextView = pTextView;
	}

	@Override
	public void returnResults(String pReturnStatement) {
		mReturnStatement = pReturnStatement;
		mActivity.runOnUiThread(updateTextViewRunnable);

	}
	
	Runnable updateTextViewRunnable = new Runnable() {
		
		@Override
		public void run() {
			
			mTextView.setText(mReturnStatement);
			
		}
	};

}
